package com.css.apps.base.func.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.css.apps.base.func.model.SFunc;
import com.css.apps.base.func.model.SFuncAction;
import com.css.apps.base.role.action.GetRole;
import com.css.core.configuration.Environment;
import com.css.db.query.QueryCache;
import com.css.util.Ajax;
import com.css.util.Messages;
import com.css.util.StringHelper;
import com.css.webbase.webwork.action.AdminAction;
import com.opensymphony.xwork.Action;

/**
 * @author FangWQ
 * @version v0.1
 * @since 2014-3-5 下午04:45:39
 */
@SuppressWarnings("serial")
public class GetFuncPoint extends AdminAction {
	private static Log log = LogFactory.getLog(GetRole.class);
	private String funcId;
	private SFunc func_item;
	private SFuncAction item;
	private String uuid;
	public GetFuncPoint() {
		
	} 

	@Override
	protected String adminGo() {
		try {
			func_item = QueryCache.get(SFunc.class, funcId);
			if(StringHelper.isNotEmpty(funcId) && func_item==null){
				setMessage(Messages.getString("systemMsg.NoFunc"));
				return Action.ERROR;
			}
			if(StringHelper.isNotEmpty(uuid)){
				item = QueryCache.get(SFuncAction.class, uuid);
			}else{
				if (StringHelper.isNotEmpty(funcId)) {
					item = new SFuncAction();
					item.setFuncCode(funcId);
					item.setSysId(func_item.getSysId());
					item.setOpenFlag("1");
				}
			}
			return Action.SUCCESS;
		} catch (Exception ex) {
			result = Ajax.JSONResult(Environment.RESULT_CODE_ERROR, Messages
					.getString("systemMsg.exception"));
			log.error(ex.getMessage(), ex);
			return Action.ERROR;
		}
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public SFunc getFunc_item() {
		return func_item;
	}

	public void setFunc_item(SFunc func_item) {
		this.func_item = func_item;
	}

	public void setItem(SFuncAction item) {
		this.item = item;
	}

	public String getFuncId() {
		return funcId;
	}

	public void setFuncId(String funcId) {
		this.funcId = funcId;
	}

	public SFuncAction getItem() {
		return item;
	}
	
	
}
